package tgc.edu.tms.repository;

import java.sql.Date;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import tgc.edu.tms.custom.CommonRepository;
import tgc.edu.tms.entity.Callnames;
@Repository
public interface CallnamesRepository extends CommonRepository<Callnames, Integer>{
	
	@Query(value = "SELECT DISTINCT banji FROM callnames", nativeQuery = true)
	public List<String> findAllBanji();
	
	@Query(value = "SELECT DISTINCT student_id FROM callnames where banji = ?1", nativeQuery = true)
	public List<Integer> findAllStudent(String banji1);

	@Query(value = "SELECT t.kc FROM callnames t WHERE t.kc = ?1 and time between ?2 and ?3 and student_id = ?4", nativeQuery = true)
	public List<Object[]> findAttendance(String kc, String time,String overtime,Integer nameid);

	@Query(value = "SELECT t.kc FROM callnames t WHERE t.kc = ?1 and time between ?2 and ?3 and student_id = ?4 and is_reach = '已到' ", nativeQuery = true)
	public List<Object[]> findAllSdcs(String kc, String time, String overtime, Integer student);
}
